#ifndef FAULT_INFO_HPP
#define FAULT_INFO_HPP
#include "stdint.h"

typedef struct DeviceFaultResponseHeader {
    uint16_t magic_number;
    uint16_t type;
    uint16_t reserved;
    uint32_t length;
    uint16_t crc16;
}__attribute__((packed)) DeviceFaultResponseHeader_t;

typedef struct DeviceFaultResponseData {
    uint8_t error_data;
}__attribute__((packed)) DeviceFaultResponseData_t;

/*!
* @brief
*  - input_type_error: 输入类型错误
*  - sd_mount_error: SD 卡挂载错误
*  - input_signal_error: 输入信号错误
*  - motor_error: 电机故障
*  - write_error: 写入错误
*  - read_error: 读取错误
*  - motor_init_position_error: 电机初始化位置错误  初始化蜂鸣器响两声
*/
typedef enum device_fault{
    none_error = 0,

    sd_mount_error,
    motor_init_positoin_error,
    motor_error ,
    input_type_error,
    input_signal_error ,
    write_error ,
    read_error ,
    detect_error,

    /* OTA */
    flash_error,
    verify_error,
    
    
} device_fault_t;


void Send_DeviceFault_Info(uint8_t fault_type);

class FaultInfo {

public:
    char set_error(char error_type_pram);
    char get_error();
    char error_event();
    char return_error(void *buffer,int error_type);

private:
    char error_type;
};

#endif
